package com.hcxdi.api.bean.auth;

import android.os.Parcel;
import android.os.Parcelable;

import com.hcxdi.api.bean.card.CardInfo;

import java.util.List;


/**
 * 登陆成功信息
 * @author 成都青桔科技有限公司
 * @version 1.0
 * @changelog 16-10-28 初始化
 */
public class Auth implements Parcelable {


    private String canAcceptScore;
    private String password;
    private String nickname = "";
    private String id;
    private long registerDate;
    private boolean driverCardStatus;
    private String salt;
    private String cashPassword;
    private String sex;
    private String availableScore;
    private String realname;
    private String token;
    private String roleIds;
    private String phone;
    private String driverCardImg;
    private String headerImg;
    private String username;
    private String status;
    private String orgName;
    /**
     * 用户类型 {@link com.hcxdi.api.bean.user.UserType}
     */
    private int userType;//用户类型 5是技工，6是司机，7是油工，8是轮胎工
    //判断是否是管理员
    private long adminId;

    private List<CardInfo> cards;

    public long getAdminId() {
        return adminId;
    }

    public void setAdminId(long adminId) {
        this.adminId = adminId;
    }

    public String getCanAcceptScore() {
        return canAcceptScore;
    }

    public void setCanAcceptScore(String canAcceptScore) {
        this.canAcceptScore = canAcceptScore;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        if (nickname == null) {
            nickname = "";
        }
        return nickname;
    }


    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public long getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(long registerDate) {
        this.registerDate = registerDate;
    }

    public boolean isDriverCardStatus() {
        return driverCardStatus;
    }

    public void setDriverCardStatus(boolean driverCardStatus) {
        this.driverCardStatus = driverCardStatus;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getCashPassword() {
        return cashPassword;
    }

    public void setCashPassword(String cashPassword) {
        this.cashPassword = cashPassword;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAvailableScore() {
        return availableScore;
    }

    public void setAvailableScore(String availableScore) {
        this.availableScore = availableScore;
    }

    public String getRealname() {
        return realname == null ? "" : realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(String roleIds) {
        this.roleIds = roleIds;
    }

    public String getPhone() {
        return phone == null ? "" : phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getDriverCardImg() {
        return driverCardImg;
    }

    public void setDriverCardImg(String driverCardImg) {
        this.driverCardImg = driverCardImg;
    }

    public String getHeaderImg() {
        return headerImg;
    }

    public void setHeaderImg(String headerImg) {
        this.headerImg = headerImg;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getOrgName() {
        return orgName == null ? "" : orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public int getUserType() {
        return userType;
    }

    public void setUserType(int userType) {
        this.userType = userType;
    }

    public List<CardInfo> getCards() {
        return cards;
    }

    public void setCards(List<CardInfo> cards) {
        this.cards = cards;
    }

    public Auth() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.canAcceptScore);
        dest.writeString(this.password);
        dest.writeString(this.nickname);
        dest.writeString(this.id);
        dest.writeLong(this.registerDate);
        dest.writeByte(this.driverCardStatus ? (byte) 1 : (byte) 0);
        dest.writeString(this.salt);
        dest.writeString(this.cashPassword);
        dest.writeString(this.sex);
        dest.writeString(this.availableScore);
        dest.writeString(this.realname);
        dest.writeString(this.token);
        dest.writeString(this.roleIds);
        dest.writeString(this.phone);
        dest.writeString(this.driverCardImg);
        dest.writeString(this.headerImg);
        dest.writeString(this.username);
        dest.writeString(this.status);
        dest.writeString(this.orgName);
        dest.writeInt(this.userType);
        dest.writeLong(this.adminId);
        dest.writeTypedList(this.cards);
    }

    protected Auth(Parcel in) {
        this.canAcceptScore = in.readString();
        this.password = in.readString();
        this.nickname = in.readString();
        this.id = in.readString();
        this.registerDate = in.readLong();
        this.driverCardStatus = in.readByte() != 0;
        this.salt = in.readString();
        this.cashPassword = in.readString();
        this.sex = in.readString();
        this.availableScore = in.readString();
        this.realname = in.readString();
        this.token = in.readString();
        this.roleIds = in.readString();
        this.phone = in.readString();
        this.driverCardImg = in.readString();
        this.headerImg = in.readString();
        this.username = in.readString();
        this.status = in.readString();
        this.orgName = in.readString();
        this.userType = in.readInt();
        this.adminId = in.readLong();
        this.cards = in.createTypedArrayList(CardInfo.CREATOR);
    }

    public static final Creator<Auth> CREATOR = new Creator<Auth>() {
        @Override
        public Auth createFromParcel(Parcel source) {
            return new Auth(source);
        }

        @Override
        public Auth[] newArray(int size) {
            return new Auth[size];
        }
    };
}
